package com.zjitc.servlet.heima;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 和用户相关的servlet
 * @author jsonor
 */
@WebServlet(name = "user", urlPatterns = {"/user/*"})
public class UserServlet extends BaseServlet {

  /**
	 * 跳转到 注册页面
	 * @param request
	 * @param response
	 * @return
	 * @throws ServletException
	 * @throws IOException
	 */
	public void add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	  response.getWriter().println("add method invoke");
	}
	
	/**
	 * 用户注册
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception 
	 */
	public void delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().println("delete method invoke");
	}
	
	/**
	 * 用户激活
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception 
	 */
	public void update(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().println("update method invoke");
	}
	
	/**
	 * 跳转到登录页面
	 * @param request
	 * @param response
	 * @return
	 * @throws ServletException
	 * @throws IOException
	 */
	public void query(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().println("query method invoke");
	}

	public void forward(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
	  request.getRequestDispatcher("/user?method=add").forward(request, response);
  }
}
